package com.InetDemo.TCPDemo_键盘录入;


import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        //ServerSocket(int port)
        //创建绑定到指定端口的服务器套接字。
        ServerSocket ss = new ServerSocket(10000);

        //监听客户端连接，返回一个socket对象
        Socket s = ss.accept();

        //获取输入流，读数据，并把数据显示在控制台
//        InputStream is = s.getInputStream();
        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }

        ss.close();

    }
}
